package com.bookstore.admin.order.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;

import com.bookstore.admin.order.dao.IAdminOrderDao;
import com.bookstore.admin.order.service.IAdminOrderService;
import com.bookstore.commons.beans.Order;
import com.bookstore.commons.beans.OrderItem;

@Controller
public class AdminOrderServiceImpl implements IAdminOrderService {

	@Autowired
	private IAdminOrderDao adminOrderDao;
	
	
	@Override
	public List<Order> findOrders() {
		return adminOrderDao.selectAllOrders();
	}


	@Override
	public List<Order> findOrderByManyCondition(Order order) {
		return adminOrderDao.selectOrderByCondition(order);
	}


	@Override
	public List<OrderItem> findOrderItemById(String id) {
		return adminOrderDao.selectOrderItemById(id);
	}


	@Override
	public boolean delOrderById(String id) {
		
		boolean flag = adminOrderDao.deleteOrderById(id);
		
			if(flag){
				adminOrderDao.deleteOrderItemById(id);
			}
			return flag;
	}

}
